<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div>Header</div>
  <div id="app">app</div>
  <div>Footer</div>

  <!-- 1.引用react -->
  <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
  <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>

  <!-- 2.使用react -->
  <script type="text/babel">
   class App extends React.Component {
     constructor() {
       super()
       this.state = {
         arr: [1, 2, 3]
       }
     }
     render() {
       return (
         <div>
          <button onClick={this.btnClick}>按钮</button>
          <ul>
          {
            this.state.arr.map((item, index) => {
              return (
                <li onClick={() => { this.liClick(item, index) }}>
                  {item}
                </li>
              )
            })
          }
          </ul>
         </div>
       )
     }
     btnClick(event) {
      console.log(event);
     }
     liClick(item, index) {
       console.log("li点击", item, index);
     }
   }
   ReactDOM.render(<App/>, document.getElementById("app"))
  </script>
</body>
</html>
